/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dispositivos;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.logging.Level;
import java.util.logging.Logger;
import baseDeDatos.*;

/**
 *
 * @author chaosad
 */
public class Bajar_Guardar implements Dispositivo{
   
   @Override
    public String leer(String... ruta) {
        
        String resultado ="";
        
        try {
        
            URL url = new URL(ruta[0]);
            URLConnection con = url.openConnection();
            
            BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream()));
            
            String line;
            
            while((line = br.readLine()) != null) resultado += line + "\n"; //lee linea a linea y termina cuando sea null.
            
        } catch (IOException ex) {
            Logger.getLogger(Fichero.class.getName()).log(Level.SEVERE, null, ex);//lo pone automaticamente.
        }
        return resultado;
    }
    
}

